package model;

import java.util.ArrayList;

import db.ImbiConnection;

public class Employee{
	private final int id;
	private int person;
	private int enterprise;
	private int struct;
	private boolean active;
	
	public Employee(int id, int person, int enterprise, int struct,
			boolean active) {
		super();
		this.id = id;
		this.person = person;
		this.enterprise = enterprise;
		this.struct = struct;
		this.active = active;
	}

	public int getId() {
		return id;
	}

	public int getPerson() {
		return person;
	}

	public void setPerson(int person) {
		this.person = person;
	}

	public int getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(int enterprise) {
		this.enterprise = enterprise;
	}

	public int getStruct() {
		return struct;
	}

	public void setStruct(int struct) {
		this.struct = struct;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}
	
	/*OBJECT ACCESS METHODS*/
	
	public ArrayList<EmployeeRole> getRoles(){
		return ImbiConnection.getEmployeeRoleDAO().findAllByEmployee(this);
	}
	
	public Person getPersonObject(){
		return ImbiConnection.getPersonDAO().find(getPerson());
	}
	
	public Enterprise getEnterpriseObject(){
		return ImbiConnection.getEnterpriseDAO().find(getEnterprise());
	}
}
